# builder alpine 3.13.5
ARG repo
FROM ${repo}/os:alpine

# base tools
RUN apk --no-cache add ca-certificates git curl wget upx jq zsh && \
    git clone https://github.com/ohmyzsh/ohmyzsh.git /root/.zsh && \
    rm -rf /root/.zsh/.git /root/.zsh/.github  && \
    rm -f /root/.zsh/.gitignore /root/.zsh/.gitpod.Dockerfile /root/.zsh/.gitpod.yml  && \
    rm -f /root/.zsh/CODE_OF_CONDUCT.md /root/.zsh/CONTRIBUTING.md /root/.zsh/README.md  && \
    ls /root/.zsh/plugins | grep -v -E '^(docker|docker-compose|git|golang|mvn|node|npm|npx|redis-cli|postgres)$' | xargs -I {} rm -rf /root/.zsh/plugins/{}  && \
    ls /root/.zsh/themes | grep -v -E '^(ys|robbyrussell).zsh-theme$' | xargs -I {} rm -rf /root/.zsh/plugins/{}  && \
    echo 'export ZSH=$HOME/.zsh'> /root/.zshrc && \
    echo 'ZSH_THEME="ys"'>> /root/.zshrc && \
    echo 'DISABLE_AUTO_UPDATE="true"'>> /root/.zshrc && \
    echo 'DISABLE_UPDATE_PROMPT="true"'>> /root/.zshrc && \
    echo 'plugins=(docker docker-compose git golang mvn node npm npx redis-cli postgres)'>> /root/.zshrc && \
    echo 'source $ZSH/oh-my-zsh.sh' >> /root/.zshrc

CMD [ "zsh" ]
